import { request } from "../utils";

const URL = "/uni-id-co"

// const URL = "/takeAway_login"

export type NamePswParams = {
    clientInfo: {
        uniPlatform: string,
        appId: string,
    },
    uniIdToken: string,
    params: {
        username: string,
        password: string
    }

}

export type LoginData = {


    errCode: number;
    newToken: {
        token: string;
        tokenExpired: number;
    },
    uid: string
    passwordConfirmed: boolean
}


export const namePswloginAPI = async (data: NamePswParams) => {
    return await request<LoginData>({
        method: 'POST',
        url: `${URL}/login`,
        data
    })
}


